<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">
    <home-page></home-page>
  </div>
  <script src="./vue.global.js"></script>
  <script src="./axios.js"></script>
  <script>
    const { createApp, h } = Vue;
    const app = createApp();
    const request = axios.create({
      baseURL: 'https://api.it120.cc/conner'
    })
    const HomePage = {
      template:`
        <div>
          <h2>home页</h2>  
        </div>
      `,
      data() {
        return {
          cates: [],
          arts: []
        }
      },
      methods: {
        fetcCates(){
          request({
            url: '/cms/category/list',
            params: {
              a: 1000,
              b: 2000
            },
            headers: {
              token: '111-222-333'
            }
          }).then(res => {
            console.log(res);
          })
        },
        fetchArts(){
          request({
            url: '/cms/news/list/v2',
            method: 'post',
            data: {
              a: 10,
              b: 20
            },
            headers: {
              token: 'aaa-bbb-ccc'
            }
          }).then(res => {
            console.log(res);
          })
        }
      },
      created () {
        this.fetchArts();
        this.fetcCates();
      },
    }
    app.component('HomePage', HomePage);
    app.mount('#app')
  </script>
</body>
</html>